#/bin/sh

if [ $# -lt 1 ]; then
echo "Usage: $0 <pack_name> [--dev]"
exit 1
fi

ROOT='/usr/local/bin'
NAME=`[ -z "$1" ] && echo "" || echo "$1"`
DEV=`[ -z "$2" ] && echo "--save" || echo "--save-dev"`

${ROOT}/npm uninstall ${NAME} ${DEV}

if [ "--save" = "$DEV" ]; then
${ROOT}/npm-shrinkwrap
${ROOT}/shrinkpack
fi